package com.dujiu.controller;

import com.dujiu.pojo.dto.LoginFormDTO;
import com.dujiu.result.Result;
import com.dujiu.service.IUserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@Api(tags = "用户相关接口")
@Slf4j
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private IUserService userService;

    // 发送手机验证码
    @PostMapping("code")
    public Result sendCode(@RequestParam("phone") String phone){
        return userService.sendCode(phone);
    }

    // 用户登录
    @PostMapping("login")
    public Result login(@RequestBody LoginFormDTO loginFormDTO){
        log.info("登录信息：{}",loginFormDTO);
        return userService.login(loginFormDTO);
    }
}












